#!/usr/bin/env bash

# Author:   Zhang Huangbin (zhb _at_ iredmail.org)

#---------------------------------------------------------------------
# This file is part of iRedMail, which is an open source mail server
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedMail is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedMail is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------

# mlmmj user/group name
export SYS_USER_MLMMJ='mlmmj'
export SYS_GROUP_MLMMJ='mlmmj'

# Directory used to store mailing list accounts and archive of in/out mails
export MLMMJ_SPOOL_DIR="${STORAGE_BASE_DIR}/mlmmj"
export MLMMJ_HOME_DIR="${MLMMJ_SPOOL_DIR}"
# Directory used to store archived mailing list accounts and data.
export MLMMJ_ARCHIVE_DIR="${STORAGE_BASE_DIR}/mlmmj-archive"
# Directory which stores skel files (templates in different languages)
export MLMMJ_SKEL_DIR='/usr/share/mlmmj/text.skel'

export CMD_MLMMJ_RECEIVE='/usr/bin/mlmmj-receive'
export CMD_MLMMJ_MAINTD='/usr/bin/mlmmj-maintd'
export CMD_MLMMJ_AMIME_RECEIVE='/usr/bin/mlmmj-amime-receive'

export CRON_FILE_MLMMJ="${CRON_SPOOL_DIR}/${SYS_USER_MLMMJ}"

if [ X"${DISTRO}" == X'FREEBSD' -o X"${DISTRO}" == X'OPENBSD' ]; then
    export CMD_MLMMJ_RECEIVE='/usr/local/bin/mlmmj-receive'
    export CMD_MLMMJ_MAINTD='/usr/local/bin/mlmmj-maintd'
    export CMD_MLMMJ_AMIME_RECEIVE='/usr/local/bin/mlmmj-amime-receive'
    export MLMMJ_SKEL_DIR='/usr/local/share/mlmmj/text.skel'
fi

#
# mlmmjadmin: RESTful API server used to manage mlmmj mailing lists
#
export MLMMJADMIN_RC_SCRIPT_NAME='mlmmjadmin'
export MLMMJADMIN_RC_SCRIPT_PATH="${DIR_RC_SCRIPTS}/${MLMMJADMIN_RC_SCRIPT_NAME}"

export MLMMJADMIN_LISTEN_PORT='7790'
export MLMMJADMIN_PID_FILE='/var/run/mlmmjadmin/mlmmjadmin.pid'

export MLMMJADMIN_VERSION='3.1.0-beta'
export MLMMJADMIN_TARBALL="mlmmjadmin-${MLMMJADMIN_VERSION}.tar.gz"

export MLMMJADMIN_PARENT_DIR='/opt'
export MLMMJADMIN_ROOT_DIR="${MLMMJADMIN_PARENT_DIR}/mlmmjadmin-${MLMMJADMIN_VERSION}"
export MLMMJADMIN_ROOT_DIR_SYMBOL_LINK="${MLMMJADMIN_PARENT_DIR}/mlmmjadmin"
export MLMMJADMIN_CONF="${MLMMJADMIN_ROOT_DIR_SYMBOL_LINK}/settings.py"

export MLMMJADMIN_LOG_DIR='/var/log/mlmmjadmin'
export MLMMJADMIN_LOG_FILE="${MLMMJADMIN_LOG_DIR}/mlmmjadmin.log"
export MLMMJADMIN_LOGROTATE_FILE="${LOGROTATE_DIR}/mlmmjadmin"
